﻿@using QDT.Common
@using QDT.Core
@using QDT.Core.Deals
@using QDT.MVC.UI
@using QDT.Web
@model QDT.Common.IPagedList<Credit>
@{
    ViewBag.Title = "投资记录";
}
<script src="/Content/Default/JS/change.js" type="text/javascript"></script>
<script type="text/javascript">
    $().ready(function () {
        $("#ui-huikuanzhong a").addClass("a_class");
    });

    $().ready(function () {
        $("#InvestmentProjects").css("background", "#e0524b");
        $("#InvestmentProjects i,#InvestmentProjects span").css("color", "white");
        $("#InvestmentProjects .san-jiaoxing").css("display", "block");
        $("#image_close").click(function () {
            $("#if-ame,#image_close").fadeOut("fast");
            document.body.removeChild(document.getElementById('m'));
        });
    });

    function showDetail_Div(Id) {
        if (!document.getElementById('m')) {
            var newMask = document.createElement("div");
            newMask.id = 'm';
            newMask.style.position = "absolute";
            newMask.style.zIndex = "55";
            newMask.style.width = document.body.scrollWidth + "px";
            newMask.style.height = document.body.scrollHeight + "px";
            newMask.style.top = "0px";
            newMask.style.left = "0px";
            newMask.style.background = "#000";
            newMask.style.filter = "alpha(opacity=40)";
            newMask.style.opacity = "0.40";
            document.body.appendChild(newMask);
            $("#if-ame,#image_close").fadeIn(1000);
            $("#if-ame").attr("src", "/User/ShowBackPlan/?id=" + Id);
        }
    }
</script>
<link href="/Content/Default/CSS/AllInvestList.css" rel="stylesheet" type="text/css" />
<style type="text/css">
    #if-ame
    {
        width: 745px;
        height: 670px;
        position: absolute;
        top: 40px;
        left: 20px;
        z-index: 56;
        display: none;
        background: white;
    }
</style>
@Html.Action("_UserBanner")
<div class="ui-bodyIn">
    <div class="ui-inner">
        <div class="ui-grid-row">
            @Html.Action("UserMenu", new { route = MenuRoute.InvestmentProjects })
            <div class="ui-grid-20" style="width: 778px;" id="right_box">
                <iframe id="if-ame" src=""></iframe>
                <img src="/Content/Default/Images/Others/close_openbox.png" id="image_close" />
                <div class="ui-box">
                    @Html.Partial("_Investmentproject")
                    <div class="ui-table-container">
                        <table style="width: 100%">
                            <!-- 可以在class中加入ui-table-inbox或ui-table-noborder分别适应不同的情况 -->
                            <thead>
                                <tr>
                                    <th style="padding-left: 50px;">
                                        项目信息
                                    </th>
                                    <th class="th_center" style="width: 160px;">
                                        债权
                                    </th>
                                    <th class="th_center">
                                        已回款
                                    </th>
                                    <th class="th_center">
                                        待回款
                                    </th>
                                    <th>
                                        &nbsp;
                                    </th>
                                    <th>
                                        &nbsp;
                                    </th>
                                </tr>
                            </thead>
                            <tbody id="datalist">
                                @foreach (var m in Model)
                                {
                                    var project = Html.F().GetProject(m.ProjectID);
                                    <tr>
                                        <td class="td_first">
                                            <span><a style="text-decoration: underline;font-size: 14px;" href="@Url.Action("Index", "Project", new { id = project.ID })">@project.Name</a></span>
                                            @if (m.AssignmentID != 0)
                                            {
                                                <div class="ready_buy">
                                                    已买债权
                                                </div>
                                            }
                                            <div style="line-height: 20px; color: #9d9d9d;">
                                                <span>预期年化收益率：</span><span>@project.Rate<span>%</span></span>&nbsp;&nbsp;<span>期限：</span><span>@project.RepayTime</span><span>个月</span><br />
                                                <span>投标时间：</span><span>@m.CreateTime</span></div>
                                        </td>
                                        <td class="td_234">
                                            <span style="@(m.Money == m.BuyMoney ? "color:#27ae60" : "color: #f39c12")">@m.Money.ToMoney()@(m.Money == m.BuyMoney ? "" : "(转)")</span><br />
                                            @if (m.AssignmentID != 0)
                                            {
                                                var creditExtension = Html.F().GetCreditExtension(m.ID);
                                                if (creditExtension != null)
                                                {
                                                    <span style="font-size: 12px;">
                                                   息: @(creditExtension.PayEarning.ToMoney()) / 折:@((creditExtension.Discount * 1).ToMoney())
                                                </span>
                                                }
                                            }
                                        </td>
                                        <td class="td_234">
                                            <span style="@(m.RepayMoney > 0 ? "color:#27ae60" : "color: #f39c12")">@m.RepayMoney.ToMoney()</span>
                                        </td>
                                        <td class="td_234">
                                            @m.WaitRepayMoney.ToMoney()
                                        </td>
                                        <td style="width: 90px;">
                                            <input id="RepayPlan" type="button" value="还款计划" class="btn_back" onclick="showDetail_Div(@m.ID)" />
                                        </td>
                                        <td style="width: 90px; text-align: center; font-size: 15px;">
                                            @if (m.AssignmentID == 0)
                                            {
                                                <a  class="check_ht" href="javascript:;" onclick=" javascript:window.open('/Project/Agreement/@m.ProjectID', '', 'width=1024px;height=768px,status=0,toolbar=no,menubar=no,location=no,scrollbars=yes,top=20,left=20,resizable=no'); ">
                                                    查看合同<i class="iconfont">&#xf02af;</i></a>
                                            }
                                            else
                                            {
                                                <a  class="check_ht" href="javascript:;" onclick=" javascript:window.open('/Assignment/Agreement/@m.ID', '', 'width=1024px;height=768px,status=0,toolbar=no,menubar=no,location=no,scrollbars=yes,top=20,left=20,resizable=no'); ">
                                                    查看合同<i class="iconfont">&#xf02af;</i></a>
                                            }
                                        </td>
                                    </tr>
                                }
                            </tbody>
                        </table>
                    </div>
                </div>
                <div style="text-align: center;">@Html.ClientPager(Model)</div>
            </div>
        </div>
    </div>
</div>
<div style="margin-top: -10px;">@Html.Partial("_BindBottomImage")</div>
